package com.crm.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @version 1.0
 * @author: CRM_SYSTEM
 * @date: 2022/4/1 17:57
 * @Description:
 */
@AllArgsConstructor
@Getter
public enum EmployeeProjectStatusEnum {

    /**
     *
     */
    ORDER_YES(1002101, "已预约"),
    ORDER_USE(1002102, "已使用"),
    ORDER_INVALID(1002103, "已作废"),
    ORDER_CANCEL(1002104, "已取消");


    private Integer code;
    private String value;


    public static List<Integer> queryValidStatus(){
       return new ArrayList<>(Arrays.asList(ORDER_YES.code,ORDER_USE.code));
    }

    public static List<Integer> queryInValidStatus(){
        return new ArrayList<>(Arrays.asList(ORDER_INVALID.code,ORDER_CANCEL.code));
    }

    public static EmployeeProjectStatusEnum getByCode(Integer code){
        if (code==null){
            return null;
        }
        for (EmployeeProjectStatusEnum statusEnum : EmployeeProjectStatusEnum.values()) {
            if (statusEnum.code.equals(code)){
                return statusEnum;
            }
        }
        return null;
    }
}
